/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

package com.cctv.esb._interface.channelinfosubscribeservice._1_0;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Logger;
import com.cctv.esb.schema.pubsub._1.ResponseType;
import com.ctvit.common.EntityClassSet;
import com.ctvit.framework.web.context.ContextHolder;
import com.ctvit.wsservice.basedata.domain.ZcdmTChanl;
import com.ctvit.wsservice.basedata.service.ChannelInfoService;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

/**
 * This class was generated by Apache CXF 3.1.4 2016-01-20T10:40:06.441+08:00
 * Generated source version: 3.1.4
 *
 */

@javax.jws.WebService(serviceName = "ReleaseChannelInfoService", portName = "ReleaseChannelInfoServiceHttpPort", targetNamespace = "http://cctv.com/CDM/service/ReleaseChannelInfoService/1.0", endpointInterface = "com.cctv.esb._interface.channelinfosubscribeservice._1_0.ChannelInfoSub")
public class ReleaseChannelInfoServiceHttpPortImpl implements ChannelInfoSub {

	private static final Logger LOG = Logger
			.getLogger(ReleaseChannelInfoServiceHttpPortImpl.class.getName());

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * com.cctv.esb._interface.channelinfosubscribeservice._1_0.ChannelInfoSub
	 * #subscribe(com.cctv.esb.schema.messagehead._0.RequestHeadType requestHead
	 * ,)com.cctv.cdm.schema.channelinfotype._1.ChannelInfoType
	 * channelInfoRequest )*
	 */
	public com.cctv.esb.schema.pubsub._1.ResponseType subscribe(
			com.cctv.esb.schema.messagehead._0.RequestHeadType requestHead,
			com.cctv.cdm.schema.channelinfotype._1.ChannelInfoType channelInfoRequest) {
		LOG.info("Executing operation subscribe");
		System.out.println(requestHead);
		System.out.println(channelInfoRequest);
		ZcdmTChanl zcdmTChanl = null;// 频道信息类
		EntityClassSet entityClassSet = new EntityClassSet();
		ChannelInfoService channelInfoService = ContextHolder
				.getBean(ChannelInfoService.class);
		com.cctv.esb.schema.pubsub._1.ResponseType _return = null;
		try {
			zcdmTChanl = entityClassSet.setZcdmTChanl(channelInfoRequest,
					zcdmTChanl);// 为频道类的属性赋值
			int i = channelInfoService.saveChannel(zcdmTChanl);// 保存频道内容
			if (i == 0) {
				_return = ResponseType.OK;// 设置返回信息
			} else if (i == 1) {
				_return = ResponseType.FAIL;// 设置返回信息
			}
			return _return;
		} catch (java.lang.Exception ex) {
			ex.printStackTrace();
			throw new RuntimeException(ex);
		}
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * com.cctv.esb._interface.channelinfosubscribeservice._1_0.ChannelInfoSub
	 * #getServiceInfo(com.cctv.esb.schema.monitor._0.GetServiceInfoRequestType
	 * getServiceInfoRequest )*
	 */
	public com.cctv.esb.schema.monitor._0.GetServiceInfoResponseType getServiceInfo(
			com.cctv.esb.schema.monitor._0.GetServiceInfoRequestType getServiceInfoRequest) {
		LOG.info("Executing operation getServiceInfo");
		System.out.println(getServiceInfoRequest);
		try {
			com.cctv.esb.schema.monitor._0.GetServiceInfoResponseType _return = null;
			return _return;
		} catch (java.lang.Exception ex) {
			ex.printStackTrace();
			throw new RuntimeException(ex);
		}
	}
}
